package deibay.server.frontend;

public class Console implements Runnable{

	private boolean keepAlive = true;
	
	public Console()
	{
		
	}
	
	public void run() {	
		while(keepAlive == true)
		{
			String command = StringReader.readLn(10);
			processCommand(command);
		}
	}
	
	private void processCommand(String command)
	{
		if(command.equals("start"))
		{
			FrontEndCore.getInstance();
		}
		if(command.equals("halt"))
		{
			FrontEndCore.getInstance().halt();
		}
		else if(command.equals("restart"))
		{
			FrontEndCore.getInstance();
		}
		else if(command.equals("exit"))
		{
			FrontEndCore.getInstance().close();
		}
		else System.out.println("!Wrong Command");
	}	
	
	public static void main(String args[])
	{
		Thread tConsole = new Thread(new Console());
		tConsole.start();
	}
}
